import React,{ useState,useEffect} from 'react'

function UseEffect(){
    let [size,setSize]=useState([window.innerWidth,window.innerHeight])

    const onresize=()=>{
        setSize([window.innerWidth,window.innerHeight])
    }
    useEffect(()=>{
        console.log("size",size)
        window.addEventListener('resize',onresize);
        
    })

    return(
        <div>
            {size[0]}  {size[1]}
        </div>
    )

}

export default UseEffect;